<div class="blade-static __bottom" ng-include="'$(Platform)/Scripts/common/templates/ok-cancel2.tpl.html'"></div>
<div class="blade-content">
    <div class="blade-inner">
        <div class="inner-block">

            <form class="form" ng-submit="add(addForm)" name="addForm" novalidate autocomplete="off">
                <fieldset>
                    <legend>{{ 'platform.blades.edit-array.labels.new-value' | translate }}</legend>
                    <div class="form-group">
                        <div class="form-input">
                            <input ng-class="{'error' : addForm.newItemValue.$invalid && !addForm.newItemValue.$pristine}" required ui-validate="'blade.validator($value)'" ng-model="newItem.value" name="newItemValue" focus-on="" placeholder="{{ 'platform.blades.edit-array.placeholders.value' | translate }}" />
                        </div>
                        <div class="form-error" ng-if="addForm.newItemValue.$dirty && addForm.newItemValue.$invalid">
                            <span ng-if="addForm.newItemValue.$error.required">{{ 'platform.blades.edit-array.validations.new-value-required' | translate }}</span>
                            <span ng-if="addForm.newItemValue.$error.validator">{{ 'platform.validators.'+blade.validator.name+'.error' | translate }}</span>
                        </div>
                    </div>
                </fieldset>

                <div class="form-group">
                    <button class="btn" ng-disabled="addForm.$invalid" type="submit">{{ 'platform.commands.add' | translate }}</button>
                </div>
            </form>

            <fieldset ng-if="blade.currentEntities.length > 0">
                <legend>{{ 'platform.blades.edit-array.labels.current-values' | translate }}</legend>
                <div class="table-wrapper">
                    <form name="formScope" class="form">
                        <table class="table __indexed" ng-init="setForm(formScope)">
                            <thead>
                                <tr>
                                    <th class="table-col">
                                        <label class="form-control __checkbox">
                                            <input type="checkbox" ng-model="blade.selectedAll" ng-change="toggleAll()" />
                                            <span class="check"></span>
                                        </label>
                                    </th>
                                    <th class="table-col">{{ 'platform.blades.edit-array.labels.values' | translate }}</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="table-item" ng-repeat="item in blade.currentEntities">
                                    <td class="table-col">
                                        <label class="form-control __checkbox">
                                            <input type="checkbox" ng-model="item.$selected">
                                            <span class="check"></span>
                                        </label>
                                    </td>
                                    <td class="table-col">
                                        <div class="form-input">
                                            <input required ng-model="item.value" type="text" />
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </fieldset>

        </div>
    </div>
</div>
